package datas
{
	import flash.filesystem.File;
	import flash.net.FileFilter;

	public class LibraryItemType
	{
		public static var IMAGE: ItemType = new ItemType( "Image", new FileFilter( "Image(*.png,*.jpg,*.jpeg)", "*.png;*.jpg;*.jpeg" ) );
		
		public static var SOUND: ItemType = new ItemType( "Sound", new FileFilter( "Sound(*.mp3)", "*.mp3" ));

		public static var SWF: ItemType = new ItemType( "FlashMovie", new FileFilter( "FlashMovie(*.swf)", "*.swf" ));
		
		public static var VIDEO: ItemType = new ItemType( "Video", new FileFilter( "Video(*.mp4,*.flv,*.f4v)", "*.mp4;*.flv;*.f4v" ));
		
		
		public function LibraryItemType()
		{
			
		}
		
		public static function getType( file: File ): String
		{
			var TYPES: Array	= [ LibraryItemType.IMAGE, LibraryItemType.SOUND, LibraryItemType.SWF, LibraryItemType.VIDEO ];
			
			var _ext: String = file.extension.toLowerCase();
			for each( var _type: ItemType in TYPES )
			{
				if( _type.fileFilter.extension.indexOf( _ext ) > -1 )
				{
					return _type.name;
				}
			}
			return null;
		}
	}
}
